#!/anaconda3/envs/FEALPy/bin python3.8
# -*- coding: utf-8 -*-
# ---
# @Software: PyCharm
# @File: main.py
# @Author: ---
# @Institution: --- University, ---, China
# @E-mail: ---@---.com, ---@---.edu.cn
# @Site: 
# @Time: 6月 24, 2024
# ---
import os
import datetime
import pytest

if __name__ == "__main__":
    # 确保 reports 目录存在
    report_dir = "reports"
    if not os.path.exists(report_dir):
        os.makedirs(report_dir)

    # 生成报告文件名
    now = datetime.datetime.now()
    report_name = f"腾讯微保_{now.strftime('%Y%m%d_%H%M%S')}.html"
    report_path = os.path.join(report_dir, report_name)

    # 运行测试并生成报告
    pytest_args = [
        "-s",
        "-v",
        "--html=" + report_path,
        "--self-contained-html",
        "testcase/test_weibao.py",
    ]
    pytest.main(pytest_args)

    print(f"测试报告已生成: {report_path}")
